(function () {
    'use strict';

    var app = angular.module('HttpService', []);

    app.service('httpService', ['$http', 'commonConfig', function ($http, commonConfig) {
        var httpOptionsDefault = {
            method: "POST",
            url: commonConfig.DbAddress,
            params: {},
            data: {},
            headers: {
                'Content-Type': 'application/json; charset=UTF-8'
            },
            transformResponse: function (data) {
                return data;
            },
            cache: false,
            timeout: 3000,
            withCredentials: false
        };

        this.createService = function (httpOptions) {

            if (!httpOptions) {
                httpOptions = httpOptionsDefault;
            }

            return  $http(httpOptions);
        };
    }]);
})();